/*******************************************************************************
Replication Materials for Blau, Kahn, Brummund, Cook, and Larson-Koester "Is 
There Still Son Preference in the United States?"

Table 4

See "CPS Read Me" for variable definitions

Date Modified: 10/23/2019

*******************************************************************************/

*Load Data
use "$cps\regfile_March_core", clear

*Keep only those who are a household head or spouse of the household head
keep if head_samp == 1

*Note additional restrictions made in regressions

label var chld1 "First Child Girl"

/*******************************************************************************

I. Natives

*******************************************************************************/

*Living Without a Father

local sample "if imm_gen==3 & citizen!=1 & gt0chld==1 & core_samp==1"

local wgt "hhwtnorm"

local controls "lths scol cold"
local controls "`controls' i.genrace i.region i.year age age2 age3"

local main "chld1"

reg femhdalt `main' `controls' `sample' [aw=`wgt'], robust
qui sum femhdalt `sample'  [aw=`wgt']
local dep_mean : display %9.4f r(mean)
local pct_effect : display %9.4f (_b[chld1]/r(mean))*100
outreg2 using "$toutput\Table_4.xls", keep(`main') title(Table 4: Effects of Female First Child on Probability of Living Without a Father and Fertility by Immigrant Generation)ctitle(3rd+ No Dad) addtext(Mean, `dep_mean', Pct. Effect, `pct_effect') label dec(4) nocons nor2 replace


*Fertility

local sample "if imm_gen==3 & citizen!=1 & gt0chld==1 & core_sampf==1"

local wgt "hhwtnorm"

local controls "lths scol cold sp_lths sp_scol sp_cold" 
local controls "`controls' i.genrace i.sp_genrace i.region i.year age age2 age3" 
local controls "`controls' sp_age sp_age2 sp_age3" 

local main "chld1"

reg nchild `main' `controls' `sample' [aw=`wgt'], robust
qui sum nchild `sample'  [aw=`wgt']
local dep_mean : display %9.4f r(mean)
local pct_effect : display %9.4f (_b[chld1]/r(mean))*100
outreg2 using "$toutput\Table_4.xls", keep(`main') ctitle(3rd+ Fertility) addtext(Mean, `dep_mean', Pct. Effect, `pct_effect') label dec(4) nocons nor2 append



/*******************************************************************************

II. Immigrants

*******************************************************************************/

*Living Without a Father

local sample "if imm_gen==1 & citizen!=1 & gt0chld==1 & core_samp==1"

local wgt "hhwtnorm"

local controls "lths scol cold"
local controls "`controls' i.genrace i.region i.year age age2 age3"

local main "chld1"

reg femhdalt `main' `controls' `sample' [aw=`wgt'], robust
qui sum femhdalt `sample'  [aw=`wgt']
local dep_mean : display %9.4f r(mean)
local pct_effect : display %9.4f (_b[chld1]/r(mean))*100
outreg2 using "$toutput\Table_4.xls", keep(`main') ctitle(1st No Dad) addtext(Mean, `dep_mean', Pct. Effect, `pct_effect') label dec(4) nocons nor2 append


*Fertility

local sample "if imm_gen==1 & citizen!=1 & gt0chld==1 & core_sampf==1"

local wgt "hhwtnorm"

local controls "lths scol cold sp_lths sp_scol sp_cold" 
local controls "`controls' i.genrace i.sp_genrace i.region i.year age age2 age3" 
local controls "`controls' sp_age sp_age2 sp_age3" 

local main "chld1"

reg nchild `main' `controls' `sample' [aw=`wgt'], robust
qui sum nchild `sample'  [aw=`wgt']
local dep_mean : display %9.4f r(mean)
local pct_effect : display %9.4f (_b[chld1]/r(mean))*100
outreg2 using "$toutput\Table_4.xls", keep(`main') ctitle(1st Fertility) addtext(Mean, `dep_mean', Pct. Effect, `pct_effect') label dec(4) nocons nor2 append


/*******************************************************************************

III. Second Generation

*******************************************************************************/

*Living Without a Father

local sample "if imm_gen==2 & citizen!=1 & gt0chld==1 & core_samp==1"

local wgt "hhwtnorm"

local controls "lths scol cold"
local controls "`controls' i.genrace i.region i.year age age2 age3"

local main "chld1"

reg femhdalt `main' `controls' `sample' [aw=`wgt'], robust
qui sum femhdalt `sample'  [aw=`wgt']
local dep_mean : display %9.4f r(mean)
local pct_effect : display %9.4f (_b[chld1]/r(mean))*100
outreg2 using "$toutput\Table_4.xls", keep(`main') ctitle(2nd No Dad) addtext(Mean, `dep_mean', Pct. Effect, `pct_effect') label dec(4) nocons nor2 append


*Fertility

local sample "if imm_gen==2 & citizen!=1 & gt0chld==1 & core_sampf==1"

local wgt "hhwtnorm"

local controls "lths scol cold sp_lths sp_scol sp_cold" 
local controls "`controls' i.genrace i.sp_genrace i.region i.year age age2 age3" 
local controls "`controls' sp_age sp_age2 sp_age3" 

local main "chld1"

reg nchild `main' `controls' `sample' [aw=`wgt'], robust
qui sum nchild `sample'  [aw=`wgt']
local dep_mean : display %9.4f r(mean)
local pct_effect : display %9.4f (_b[chld1]/r(mean))*100
outreg2 using "$toutput\Table_4.xls", keep(`main') ctitle(2nd Fertility) addtext(Mean, `dep_mean', Pct. Effect, `pct_effect') label dec(4) nocons nor2 append


